<template>
  <div id="app">
    <component :is="currentLayout">
      <router-view></router-view>
    </component>
  </div>
</template>

<script setup lang="ts">
import { RouterView, useRoute } from 'vue-router'
import Layout from './layout/index.vue' // 导入主布局
import LoginView from './views/LoginView.vue' // 导入登录页面组件
import { computed } from 'vue'

const route = useRoute()

const currentLayout = computed(() => {
  if (route.meta.layout === 'login') {
    return LoginView
  } else if (route.meta.layout === 'main') {
    return Layout
  }
  return null // 如果没有提供 meta.layout，则不使用布局
})
</script>
